package my.yuan.ms.rediskafkams.res;

import java.io.Serializable;

public class CommonReturnType implements Serializable {
    private String status;
    private Object data;

    public CommonReturnType() {
    }

    public CommonReturnType(String status, Object data) {
        this.status = status;
        this.data = data;
    }

    public static CommonReturnType success(Object result) {
        return CommonReturnType.create(result, "success");
    }
    public static CommonReturnType fail(Object result) {
        return CommonReturnType.create(result, "fail");
    }

    public static CommonReturnType create(Object result) {
        return CommonReturnType.create(result, "success");
    }

    public static CommonReturnType create(Object result, String status) {
        CommonReturnType commonReturnType = new CommonReturnType();
        commonReturnType.setData(result);
        commonReturnType.setStatus(status);
        return commonReturnType;
    }
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "CommonReturnType{" +
                "status='" + status + '\'' +
                ", data=" + data +
                '}';
    }
}

